﻿using System;
using System.Web;
using Bintje;

public partial class UI_home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            Bintje.bintje.imageoSession currentSession = HttpContext.Current.Session["Session"] as Bintje.bintje.imageoSession;

            if (null != currentSession)
            {
                User user = new User(currentSession);

                if (user.Trails != null && user.Trails.Count > 0)     // If the user has some trails
                    GMap1.TrailID = user.Trails[0].Id;              // set the trail id

                // Show HomeWorldMap
                GMap1.LoadHomeWorldMap();
            }
            else
            {
                // IF we don't have a session, just show the world map
                GMap1.LoadWorldMap();
            }
        }
    }
}
